/*
 * EventRedirector.java
 *
 * Created on June 9, 2007, 7:46 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.jerm.Interface.JGraph_Diagrama;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import org.jgraph.JGraph;

/**
 *
 * @author tiagofalcao
 */
public class EventRedirector extends AbstractAction {

        protected Action action;
        protected JGraph graph;

        // Construct the "Wrapper" Action
        public EventRedirector(Action a,ImageIcon i,JGraph g) {
                super("", i);
                this.action = a;
                this.graph=g;
        }

        // Redirect the Actionevent
        public void actionPerformed(ActionEvent e) {
                e = new ActionEvent(graph, e.getID(), e.getActionCommand(), e
                                .getModifiers());
                action.actionPerformed(e);
        }
}
